package com.whmnx.home.ui.adapter;

import android.content.Context;

import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.classic.adapter.BaseAdapterHelper;
import com.classic.adapter.CommonRecyclerAdapter;
import com.whmnx.base.bean.OrderBean;
import com.whmnx.home.R;

/**
 * author : huang
 * date   : 2020/10/19 0019 9:17
 * version: 1.0
 * @author Administrator
 */
public class OrderListAdapter extends CommonRecyclerAdapter<OrderBean.ShopModelBean> {
    Context context;

    public OrderListAdapter(Context context) {
        super(context, R.layout.item_order3);
        this.context = context;
    }


    @Override
    public void onUpdate(BaseAdapterHelper helper, OrderBean.ShopModelBean item, int position) {

          //  helper.setText(R.id.tv_Product_Name, (String) item.getProductList().get(0).getProduct_Name());
         //   helper.setText(R.id.tv_Product_SPEC, (String) item.getProductList().get(0).getProduct_SPEC());
            helper.setText(R.id.tv_redBagMoney, "￥" + item.getRedBagMoney());
          //  helper.setText(R.id.tv_Product_Num, "X" + item.getProductList().get(0).getProduct_Num());

          /*  if (!TextUtils.isEmpty(item.getProductList().get(0).getProduct_Image())) {
                String[] split = item.getProductList().get(0).getProduct_Image().split(",");
                String url = split[0];
                ImageUtil.setImage((RoundImageView) helper.getView(R.id.iv_img), url);
            }*/


        RecyclerView rlList =  helper.getView(R.id.rl_list);
        rlList.setLayoutManager(new LinearLayoutManager(context));
        rlList.setItemAnimator(new DefaultItemAnimator());
        OrderListAdapter2   mOrderListAdapter = new OrderListAdapter2(context);
        rlList.setAdapter(mOrderListAdapter);
        mOrderListAdapter.addAll(item.getProductList());
    }
}
